<?php 
    // 运行在服务端的代码
    require_once '../../common/DBHelper.php';
    // 获取前端传递回来的id
    $id = $_POST['id'];
    // 删除数据
    $result = deleteById('categories',$id);
    $response = [
        'code' => 0, 
        'msg' => '操作失败'
    ];
    if($result){
        $response['code'] = 1;
        $response['msg'] = '操作成功';
    }
    // 返回数据
    echo json_encode($response,JSON_UNESCAPED_UNICODE);
?>